// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   Win32ParallelPort.java

package com.sun.comm;

import java.io.*;
import java.util.TooManyListenersException;
import javax.comm.*;

class Win32ParallelPort extends ParallelPort
{

    private File prfile;
    private OutputStream outstream;
    private boolean closed;

    Win32ParallelPort(String s)
        throws IOException
    {
        closed = false;
        name = s;
        try
        {
            prfile = new File(s);
        }
        catch(NullPointerException nullpointerexception)
        {
            throw new IOException(nullpointerexception + " while opening port");
        }
        outstream = new FileOutputStream(prfile);
    }

    @Override
	public void addEventListener(ParallelPortEventListener parallelporteventlistener)
        throws TooManyListenersException
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return;
    }

    @Override
	public void removeEventListener()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return;
    }

    @Override
	public void notifyOnError(boolean flag)
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return;
    }

    @Override
	public void notifyOnBuffer(boolean flag)
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return;
    }

    @Override
	public int getOutputBufferFree()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return 512;
    }

    @Override
	public boolean isPaperOut()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return false;
    }

    @Override
	public boolean isPrinterBusy()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return false;
    }

    @Override
	public boolean isPrinterSelected()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return false;
    }

    @Override
	public boolean isPrinterTimedOut()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return false;
    }

    @Override
	public boolean isPrinterError()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return false;
    }

    @Override
	public void restart()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return;
    }

    @Override
	public void suspend()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return;
    }

    @Override
	public int getMode()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return 1;
    }

    @Override
	public InputStream getInputStream()
        throws IOException
    {
        throw new IOException("Unsupported operation. Output only mode");
    }

    @Override
	public OutputStream getOutputStream()
        throws IOException
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return outstream;
    }

    @Override
	public void enableReceiveThreshold(int i)
        throws UnsupportedCommOperationException
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return;
    }

    @Override
	public void disableReceiveThreshold()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return;
    }

    @Override
	public boolean isReceiveThresholdEnabled()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return false;
    }

    @Override
	public int getReceiveThreshold()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return 1;
    }

    @Override
	public void enableReceiveTimeout(int i)
        throws UnsupportedCommOperationException
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return;
    }

    @Override
	public void disableReceiveTimeout()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return;
    }

    @Override
	public boolean isReceiveTimeoutEnabled()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return false;
    }

    @Override
	public int getReceiveTimeout()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return 0;
    }

    @Override
	public void enableReceiveFraming(int i)
        throws UnsupportedCommOperationException
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return;
    }

    @Override
	public void disableReceiveFraming()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return;
    }

    @Override
	public int getReceiveFramingByte()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return 0;
    }

    @Override
	public boolean isReceiveFramingEnabled()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return false;
    }

    @Override
	public void setInputBufferSize(int i)
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return;
    }

    @Override
	public int getInputBufferSize()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return 1024;
    }

    @Override
	public void setOutputBufferSize(int i)
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return;
    }

    @Override
	public int getOutputBufferSize()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        else
            return 1024;
    }

    @Override
	public int setMode(int i)
        throws UnsupportedCommOperationException
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        if(i != 1)
            throw new UnsupportedCommOperationException();
        else
            return 1;
    }

    @Override
	public void close()
    {
        if(closed)
            throw new IllegalStateException("Port Closed");
        try
        {
            outstream.close();
        }
        catch(IOException _ex) { }
        closed = true;
        super.close();
    }
}
